CC=g++
KMEANS=kmeans
CFLAGS=-Wall -g
LFLAGS=-lCGAL -lgmp -lm
LIB_PATH=-L/usr/local/lib
MAIN=main
SOURCES=$(shell ls *.cpp)
SOURCE_OBJS=$(SOURCES:.cpp=.o)

build: $(SOURCE_OBJS)
	cd $(KMEANS);make ; cd ../
	$(CC) $(LFLAGS) $(CFLAGS) $(LIB_PATH) $(SOURCE_OBJS) $(KMEANS)/*.o -o $(MAIN)

%.o: $*.cpp $*.h cgal_helper.h
	$(CC) $(CFLAGS) -c $*.cpp

all: build

clean:
	cd $(KMEANS);make clean;cd ../
	rm -f $(MAIN)
	rm -f $(SOURCE_OBJS)

test: build
	./$(MAIN) coordinates.txt
